/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.entity.Activity;
import com.qdu.service.ActivityService;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *点查询按钮后会转到这个页面，显示一行信息。
 * @author 19645
 */
@WebServlet("/manageGnms")
public class GetManageAvtiByNameServlet extends HttpServlet{
    
    ActivityService activityService=new ActivityService();
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
        //获取提交的活动名称关键字
        String keyword = req.getParameter("keyword");
        
        //2. 执行业务逻辑 
        //调用ActivityService类的findActivitysByKeyword()方法根据关键字查询活动列表
        //但是并没有查询活动的所有信息，只是查询了基本信息
        List<Activity> manageList = activityService.findActivityByKey(keyword);

        //3. 生成动态响应
        //将查到的活动列表作为属性放入请求对象，movie_list.jsp页面显示活动信息
        req.setAttribute("manageActi_list", manageList);
        req.getRequestDispatcher("/ManageActi_list.jsp").forward(req, resp);
        
    }
}
